package rmi.filesystem.client;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import java.rmi.RemoteException;

import rmi.filesystem.common.IRemoteOutputStream;


@SuppressWarnings("serial")
public class RemoteOutputStreamWrapper extends OutputStream implements Serializable {

	IRemoteOutputStream os;
	
	public RemoteOutputStreamWrapper(IRemoteOutputStream os){
		this.os = os;
		
	}
	
	@Override
	public void write(int b) throws RemoteException {
		// TODO Auto-generated method stub
		try{
			os.write(b);
		}catch(IOException e){
			throw new RemoteException("RemoteOutputStreamImpl", e);
		}
		
	}

	public void write(byte[] b, int off, int lenght) throws RemoteException {
		// TODO Auto-generated method stub
		try{
			os.write(b, off, lenght);
		}catch(IOException e){
			throw new RemoteException("RemoteOutputStreamImpl", e);
		}
	}

	public void close() throws IOException, RemoteException {
		// TODO Auto-generated method stub
		try{
			os.close();
		}catch(IOException e){
			throw new RemoteException("RemoteOutputStreamImpl", e);
		}
	}
}
